<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">
<h:head>
	<h:outputStylesheet name="css/estilo.css" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>FAPES - Ferramento de Apoio a Planejamento de Estudos
		Experimentais</title>
	<style>
body {
	font-size: 12px;
}
</style>

</h:head>
<h:body>
	<f:view locale="#{i18N.locale}">
		<div id="header">

			<h:panelGrid columns="2" cellpadding="0" cellspacing="0"
				columnClasses="img,lang" width="100%">
				<h:graphicImage name="img/header_uni.jpg" />
				<h:panelGrid columns="1">
					<h:outputText value="BASILI" id="sist" />
					<h:outputText value="#{msgs.labelSistema}" />
				</h:panelGrid>
			</h:panelGrid>

			<h:form>
				<p:menubar autoDisplay="false">
					<p:submenu label="Arquivo">
						<p:submenu label="Novo">
							<p:menuitem value="Nova Pesquisa"
								action="#{menuController.pageIdentificationRegister}"
								icon="ui-icon-minus" />
						</p:submenu>
						<p:menuitem value="Abrir" url="#" />
						<p:menuitem value="Sair" url="#" />
					</p:submenu>

					<p:submenu label="Cadastros">
						<p:menuitem value="#{msgs.researcher}"
							action="#{menuController.pageResearcherRegister}" />
					</p:submenu>

					<p:menuitem value="Exportações" url="#" />

					<p:submenu label="Ajuda">
						<p:menuitem value="Versão" url="#" />
						<p:menuitem value="Sobre" url="#" />
					</p:submenu>

				</p:menubar>
			</h:form>
		</div>

		<p:panel header="#{msgs.busca}">
			<h:form>
				<p:panel header="#{msgs.filtroPesq}">
					<p:growl id="growl" sticky="false" showDetail="true" />
					<h:panelGrid columns="3">

						<h:outputText value="#{msgs.titulo}" />
						<h:outputText value="#{msgs.tema}" />
						<h:outputText value="#{msgs.pesquisador}" />

						<p:inputText value="#{protocolMB.title}" />
						<p:inputText value="#{protocolMB.theme}" />
						<p:selectOneMenu value="#{protocolMB.researcher}"
							converter="researchConverter">
							<f:selectItem itemLabel="#{msgs.selecione}" itemValue="#{null}" />
							<f:selectItems value="#{protocolMB.listResearcher}" var="aut"
								itemLabel="#{aut.name}" itemValue="#{aut}" />
						</p:selectOneMenu>
					</h:panelGrid>

					<h:panelGrid columns="1">
						<p:commandButton actionListener="#{protocolMB.pesquisar}"
							icon="ui-icon-search" value="#{msgs.pesquisar}"
							update="pesquisadores" />
					</h:panelGrid>
				</p:panel>

				<p:spacer height="20" />

				<p:panel id="ptc" header="#{msgs.resultado}">
					<p:dataTable id="pesquisadores" value="#{protocolMB.listProtocol}"
						var="protocol">
						<p:column headerText="#{msgs.titulo}">
							<h:outputText value="#{protocol.identification.title}" />
						</p:column>
						<p:column headerText="#{msgs.tema}">
							<h:outputText value="#{protocol.identification.theme}" />
						</p:column>
						<p:column headerText="#{msgs.pesquisadores}">
							<p:dataList value="#{protocol.identification.researchers}"
								var="research" style="border:none;">    
                    		#{research.name} - #{research.email}    
                		</p:dataList>
						</p:column>
						<p:column headerText="#{msgs.acoes}">
<!-- 							<f:facet name="header"> -->
<!-- 								<p:commandButton id="viewButton" value="View" -->
<!-- 									icon="ui-icon-search" update=":form:display" -->
<!-- 									oncomplete="PF('carDialog').show()" /> -->
<!-- 							</f:facet> -->
							<p:commandButton action="#{protocolMB.preparaEdicao}"
								icon="ui-icon-pencil" title="" onclick="this.form.target='_self'" ajax="false">
								<f:param name="acao" value="editar" />
								<f:param name="codigo" value="#{protocol.codigo}" />
							</p:commandButton>
							|
							<p:commandButton action="#{protocolMB.deleteProtocol(protocol)}"
								title="#{msgs.t}" icon="ui-icon-trash" onclick="this.form.target='_self'"   />
							|
								<p:commandButton
									actionListener="#{relatorioBean.gerarRelatorio(protocol)}"
									title="#{msgs.t}" icon="ui-icon-print" onclick="this.form.target='_blank'" ajax="false" />
						</p:column>

					</p:dataTable>
				</p:panel>
			</h:form>
		</p:panel>



		<div id="footer">
			<h:form>
				<p:panel>
					<h:panelGrid columns="2" cellpadding="0" cellspacing="0"
						rendered="#{i18N.bIngles}" width="100%" rowClasses="lang"
						columnClasses=" ,bandeira">
						<h:commandButton id="en" title="inglês"
							image="/resources/img/usa.png" action="#{i18N.changLangEn}" />
						<h:commandLink value="English" action="#{i18N.changLangEn}" />
					</h:panelGrid>

					<h:panelGrid columns="2" cellpadding="0" cellspacing="0"
						rendered="#{i18N.bPortugues}" width="100%" rowClasses="lang"
						columnClasses=" ,bandeira">
						<h:commandButton id="pt" title="português"
							image="/resources/img/brasil.png" action="#{i18N.changLangPt}" />
						<h:commandLink value="Português" action="#{i18N.changLangPt}" />
					</h:panelGrid>
				</p:panel>
			</h:form>
		</div>
	</f:view>
</h:body>
</html>